#pragma once
#include "vocoder.h"
#include "SampleMarker.h"

#include <vector>
//#include <pair>
#include <list>


typedef std::pair<std::vector<short>, std::vector<SampleMarker>> SampleWithMarkers;

/*
Modulator implementation that has stored samples which it returns on NextModulatorSample
When it has finished returning all samples, it does not loop but returns false when NextModulatorSample is called after that
*/
class ModulatorImpl :
	public Modulator
{
public:
	ModulatorImpl(void);
	~ModulatorImpl(void);

	/*
	Clears all previously set samples
	ModulatorImpl stores its own copy so caller must deal with disposal of sample arrays
	*/
	void SetSample(short* sample, unsigned int length, std::vector<SampleMarker>* incomingMarkers=NULL);

	/*
	Adds new sample at the end of the current samples
	ModulatorImpl stores its own copy so caller must deal with disposal of sample arrays
	*/
	void AddSample(short* sample, unsigned int length, std::vector<SampleMarker>* incomingMarkers=NULL);

	bool NextModulatorSample(short* output, unsigned int length, std::vector<SampleMarker>* markersReceiver=NULL);

private:
	std::list<SampleWithMarkers> samples;
	unsigned int curIdx;
};
